﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace WindowsEventLog
{
    public partial class WindowsEventLog : Form
    {
        public WindowsEventLog()
        {
            InitializeComponent();
        }

        private void btnWriteLog_Click(object sender, EventArgs e)
        {
            string sSource;
            string sLog;
            string sEvent;

            sSource = "Kofax Clustering Utility for KTM";
            sLog = "Application";
            sEvent = txtContent.Text;

            if (!EventLog.SourceExists(sSource))
                EventLog.CreateEventSource(sSource, sLog);

            EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Error);
            //EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Warning, 234);
        }
    }
}
